var probe = require('../../global');
probe.service('fullScreen', function ($rootScope) {
	docElm = document.documentElement;

	function full(params) {
		if (docElm.requestFullscreen) {
			docElm.requestFullscreen();
		}
		else if (docElm.msRequestFullscreen) {
			docElm.msRequestFullscreen();
		}
		else if (docElm.mozRequestFullScreen) {
			docElm.mozRequestFullScreen();
		}
		else if (docElm.webkitRequestFullScreen) {
			docElm.webkitRequestFullScreen();
		}
	}

	function exitFull(params) {
		if (document.exitFullscreen) {
			document.exitFullscreen();
		}
		else if (document.msExitFullscreen) {
			document.msExitFullscreen();
		}
		else if (document.mozCancelFullScreen) {
			document.mozCancelFullScreen();
		}
		else if (document.webkitCancelFullScreen) {
			document.webkitCancelFullScreen();
		}
	}

	return {
		request: full,
		exit: exitFull
	};
});
